package com.yl.users.common.enum

import com.baomidou.mybatisplus.annotation.EnumValue
import com.fasterxml.jackson.annotation.JsonValue

/**
 * 代办事项所有状态
 * value,值，
 * name,名称
 */
enum class TodoFlag(@EnumValue val code:Int, @JsonValue val typeName:String) {
    TO_BE_PROCESSED(1,"待处理"),
    //已完成事项，50以前的值都是未完成,会被超时处理计算到,50以后的就不可直接更改了
    COMPLETED(50,"已完成"),
    TIME_OUT(60,"已超时");

    companion object {
        fun getEnum(d: Int?): TodoFlag {
            return TodoFlag.values()
                .find { it.code == (d ?: return TodoFlag.TO_BE_PROCESSED) } ?: TodoFlag.TO_BE_PROCESSED
        }
    }

    fun getMap():MutableMap<String,Any>{
        val map = mutableMapOf<String,Any>()
        map["id"] = this.typeName
        map["name"] = this.typeName
        return map
    }
}




